import request from '@/utils/request'

// 添加活动
export const addActivity = (data) => request.post('activity/add', data)
// 编辑活动
export const editActivity = (data) => request.post('activity/edit', data)
// 发布活动
export const publishActivity = (data) => request.post('activity/publish', data, {
  validateStatus: (status) => status === 200 || status === 409 // 允许409状态（重复提交）
})
// 参与的活动
export const joinActivity = (data) => request.post('user/myJoinActivity', data)
// 培训师列表
export const trainerList = () => request.get('/coach/list')
// 热门活动 活动列表
export const activityLists = () => {
    console.log('调用活动列表接口');
    return request.get('/activity/lists')
}
//活动详情
export const activityDetail = (params) => {
    console.log('调用活动详情接口，参数:', params);
		if(!params.id) return
    return request.get('/activity/detail', { params })
}
// 计算活动收益
export const activityIncome = (data) => request.post('activity/computeIncome',data)

// 添加状态常量
export const ACTIVITY_STATUS = {
  DRAFT: 0,
  PENDING_REVIEW: 1,
  APPROVED: 2,
  CLOSED: 3,
  REJECTED: -1
}
